﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using XMK.Tadong.Biz;
using XMK.Tadong.Model;
using System.Data.OleDb;

namespace XMK.Tadong.Web.TJ
{
    public partial class TJ_NYTJ : System.Web.UI.Page
    {
        #region 变量

        //protected tj_webservice.tj_service serclient;
        string TJDMStr, CWStr, UserID, JHStr, MAXStr, MINStr;
        double DingJSDfl, DIJSDfl, HDfl, MAXfl, MINfl, AVEfl, LJZfl, SDBfl;
        protected System.Web.UI.WebControls.Button NYButton;

        #endregion 变量

        protected void Page_Load(object sender, System.EventArgs e)
        {
            //Response.Charset = "GB2312";

            //serclient = new tj_webservice.tj_service();
            //UserCode = Session["UserCode"].ToString();


            //MacStr = Session["MacAddress"].ToString();
            //if (DownRight == "0")
            //{
            //    btnDownLoad.Visible = false;
            //}
            //if (!IsPostBack)
            //{
            //    string strJHList = "";
            //    string strSql = "select distinct jh  from  giswell where jh in (select jh from zhuluoji.yqcjd)";
            //    DataSet ds = serclient.GetDataSet(strSql);
            //    int numcount = ds.Tables[0].Rows.Count;
            //    if (numcount > 20)
            //        numcount = 20;  //如果满足条件的井太多，后面构造的查询语句会过长，导致错误，所以这里限制只显示２０口井

            //    for (int i = 0; i < numcount; i++)
            //    {
            //        strJHList += "," + ds.Tables[0].Rows[i][0].ToString();
            //    }
            //    if (strJHList != "")
            //        strJHList = strJHList.Substring(1, strJHList.Length - 1);
            //    inputJH.Text = strJHList;

            //}

        }


        protected string GetHaveCW(string stringjh)
        {

            string strReturn = "";
            //client=new Service2 ();
            YQCJDBLL bll = new YQCJDBLL();
           // string str = "select distinct(YCZMC) from YQCJD where JH in(" + stringjh + ") ";
            string strWhere = @" and JH in (" + stringjh + ")";

            DataSet ds = bll.GetData(strWhere);
            int numcount = ds.Tables[0].Rows.Count;
            for (int i = 0; i < numcount; i++)
            {
                strReturn += "," + ds.Tables[0].Rows[i]["YCZMC"].ToString();
            }
            if (strReturn != "")
                strReturn = strReturn.Substring(1, strReturn.Length - 1);
            return strReturn;
        }


        protected void SYButton_Click(object sender, System.EventArgs e)
        {
            string dt = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"); //DateTime.Now.ToShortDateString();
            TJDMStr = UserID + "/" + dt + "/" + "泥岩";
            usertb.Text = TJDMStr;


            string str, strsy;
            string strresult = "";
            int num = ckboxlist.Items.Count;
            JHStr = tb.Text;

            string delestr = "select count(*) from xmk_a_z_ny01 where JH in(" + JHStr + ")";
            XMK_A_Z_NY01Biz biz = new XMK_A_Z_NY01Biz();

            if (biz.IsExist(delestr))
            {
                string deletestr = "delete from xmk_a_z_ny01 where JH in(" + JHStr + ")";
                biz.Delete(deletestr);
            }
            if (JHStr == "请选择")
            {
                MessageLabel.Text = "请选择JH！";
                return;
            }

            //JHStr="'"+JHStr+"'";

            for (int i = 0; i < num; i++)
            {
                if (ckboxlist.Items[i].Selected)
                    strresult += "'" + ckboxlist.Items[i].Text + "'" + ",";
            }

            if (strresult.Length == 0)
            {

                MessageLabel.Text = "请选择统计类型！";
            }
            else
            {
                strresult = strresult.Substring(0, strresult.Length - 1);

                try
                {

                    str = " and (JH in (" + JHStr + "))";
                    YQCJDBLL yqcbll = new YQCJDBLL();
                   
                    DataSet ds1= yqcbll.GetData(str);// = serclient.GetDataSet(str); //得到数据集
                    int number = ds1.Tables[0].Rows.Count;//记录集的数目1891
                    if (number == 0)
                        MessageLabel.Text = "没有符合条件的统计值！";
                    else
                    {
                        double dlx = 0, dly = 0;
                        for (int i = 0; i < number; i++)//对应的是每一层
                        {
                            string hjyjh = ds1.Tables[0].Rows[i]["JH"].ToString();

                            //string strzb = "select X,Y from GISWELL where JH='" + hjyjh + "'";
                            //DataSet dszb = serclient.GetDataSet(strzb);
                            //dlx = Convert.ToDouble(dszb.Tables[0].Rows[0][0].ToString());
                            //dly = Convert.ToDouble(dszb.Tables[0].Rows[0][1].ToString());
                            MAXfl = MINfl = AVEfl = LJZfl = 0;
                            JHStr = JHStr;
                            DingJSDfl = Convert.ToDouble(ds1.Tables[0].Rows[i]["DJSD1"].ToString());
                            DIJSDfl = Convert.ToDouble(ds1.Tables[0].Rows[i]["DJSD2"].ToString());
                            CWStr = ds1.Tables[0].Rows[i]["YCZMC"].ToString();
                            HDfl = DIJSDfl - DingJSDfl;
                            //strny="select * from  LJT_YXPM where (JH='"+JHStr+"')and (DJSD1 >='"+DingJSDfl+"')and  (DJSD2<='"+DIJSDfl+"') and (YXMC like '%泥岩%')";
                            strsy = " and (JH='" + hjyjh + "')and (DBSD1 >='" + DingJSDfl + "')and  (DBSD<='" + DIJSDfl + "') and (YXMC in(" + strresult + "))";
                            LJT_YXPMBLL ljtbll = new LJT_YXPMBLL();

                            DataSet ds2 = ljtbll.GetData(strsy);//serclient.GetDataSet(strsy);
                            int number2 = ds2.Tables[0].Rows.Count;
                            if (number2 == 0)
                                MessageLabel.Text = MessageLabel.Text;
                            else
                            {

                                int j;
                                LJZfl = 0;
                                for (j = 0; j < number2; j++)//比较大小取出最大，最小，平均值
                                {
                                    //string JHSTR1;

                                    double Dingj, DIj;
                                    // JHSTR1=ds2.item[j][0];
                                    Dingj = Convert.ToDouble(ds2.Tables[0].Rows[j]["DJSD1"].ToString());
                                    DIj = Convert.ToDouble(ds2.Tables[0].Rows[j]["DJSD2"].ToString());
                                    if (j == 0)
                                    {

                                        MAXfl = MINfl = AVEfl = LJZfl = DIj - Dingj;

                                    }
                                    else
                                    {
                                        if ((DIj - Dingj) >= MAXfl) MAXfl = Convert.ToDouble(DIj - Dingj);
                                        if ((DIj - Dingj) <= MINfl) MINfl = Convert.ToDouble(DIj - Dingj);
                                        LJZfl = LJZfl + (DIj - Dingj);
                                    }
                                }
                                AVEfl = LJZfl / j;
                                SDBfl = LJZfl / HDfl;
                                MAXfl = Math.Round(MAXfl, 2);
                                MINfl = Math.Round(MINfl, 2);
                                HDfl = Math.Round(HDfl, 2);
                                AVEfl = Math.Round(AVEfl, 2);
                                LJZfl = Math.Round(LJZfl, 2);
                                SDBfl = Math.Round(SDBfl, 2);
                                string stringjh = ds1.Tables[0].Rows[i]["JH"].ToString();
                                XMK_A_Z_NY01Info model = new XMK_A_Z_NY01Info();
                                model.JH = stringjh;
                                model.DJDM = TJDMStr;
                                model.CW = CWStr;
                                model.DINGJSD = Convert.ToDecimal(DingJSDfl);
                                model.DIJSD = Convert.ToDecimal(DIJSDfl);
                                model.HD = Convert.ToDecimal(HDfl);
                                model.MAX = Convert.ToDecimal(MAXfl);
                                model.MIN = Convert.ToDecimal(MINfl);
                                model.AVER = Convert.ToDecimal(AVEfl);
                                model.LJHD = Convert.ToDecimal(LJZfl);
                                bool bl =biz.Add(model);
                                if (bl == false)
                                {
                                    MessageLabel.Text = "没有成功统计！";
                                    return;
                                }

                            }
                        }
                    }
                    Session["hjyjhstr"] = JHStr;
                    btnDownLoad.Enabled = true;
                    //JHStr=ddlHaveDataJH.SelectedItem.Value;
                    string strds = " and DJDM='" + usertb.Text + "' and JH in (" + JHStr + ") order by DINGJSD asc";

                    DataSet dataset = biz.GetData(strds);//serclient.GetDataSet(strds);
                    if (dataset.Tables[0].Rows.Count == 0)
                        MessageLabel.Text = "没有统计数据！";
                    else
                    {
                        TJDataGrid.DataSource = dataset;
                        TJDataGrid.DataBind();
                        string sql = "";
                        sql = " and JH IN(" + tb.Text + ") order by dingjsd";
                        BindPeople(sql);
                    }
                }
                catch (Exception ee)
                {
                    throw ee;
                }
            }

        }


        protected void FillListFromPara(string p_JH, DropDownList p_ddl)
        {
            p_ddl.Items.Clear();
            p_ddl.Items.Add("请选择");

            string[] split = null;
            split = p_JH.Split(',');
            foreach (string s in split)
            {
                p_ddl.Items.Add(s);
            }

        }//protected void FillListFromPara

        /// <summary>
        /// 根据JH列表在数据库中查询有那些井有录井图的数据，返回有数据的JH列表
        /// </summary>
        /// <param name="p_strJH">JH列表，型如：敖1,敖2,古23</param>
        /// <returns>JH列表，型如：敖1,敖2</returns>
        protected string GetHaveDataJH(string stringjh)
        {
            string strReturn = "";
            stringjh = stringjh.Replace(",", "','");
            stringjh = "'" + stringjh + "'";
            YQCJDBLL bll = new YQCJDBLL();

            string strSQL = "select distinct(JH)   from zhuluoji.YQCJD where JH in (" + stringjh + ")";
            DataSet ds = bll.GetHaveDataJH(stringjh);
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i > ds.Tables[0].Rows.Count; i++)
                {
                    strReturn = ds.Tables[0].Rows[i][0].ToString() + ",";
                }
            }


            if (strReturn != "")
                strReturn = strReturn.Substring(1, strReturn.Length - 1);
            return strReturn;

        }//protected void GetHaveDataJH


        protected void Checkall_CheckedChanged(object sender, System.EventArgs e)
        {
            int num = ckboxlist.Items.Count;
            if (Checkall.Checked == true)
            {
                for (int i = 0; i < num; i++)
                {
                    ckboxlist.Items[i].Selected = true;
                }
            }
            else
            {
                for (int i = 0; i < num; i++)
                {
                    ckboxlist.Items[i].Selected = false;
                }
            }
        }

        protected void btnDownLoad_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (TJDataGrid.Items.Count == 0)
                {
                    throw new Exception("没有数据不能导出！");
                }
                string FileName = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");
                FileName = System.Web.HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8) + ".xls";
                ExportDataGrid(TJDataGrid, "application/ms-excel", FileName);
            }
            catch (Exception ex)
            {
                Response.Write("<script language =javascript >alert('" + ex.Message + "');</script>");
                return;
            }
            //DataSetToExcel();
        }


        /// <summary>从DataGrid导出指定类型的文件</summary>
        /// <summary>Super 2005/8/18</summary>
        /// <param name="ctl">DataGrid的ID</param>
        /// <param name="FileType">导出文件类型//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword ;//application/ms-excel</param>
        /// <param name="FileName">导出的文件名</param>
        /// <returns>文件</returns>
        public static void ExportDataGrid(System.Web.UI.Control ctl, string FileType, string FileName)
        {
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
            HttpContext.Current.Response.Charset = "gb2312";
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
            HttpContext.Current.Response.ContentType
            = FileType;//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword ;//application/ms-excel
            ctl.Page.EnableViewState = false;
            System.IO.StringWriter tw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
            ctl.RenderControl(hw);
            HttpContext.Current.Response.Write(tw.ToString());
            HttpContext.Current.Response.End();
        } 


        protected void ButtonSYCW_Click(object sender, System.EventArgs e)
        {
            string dt = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"); //DateTime.Now.ToShortDateString();
            TJDMStr = UserID + "/" + dt + "/" + "泥岩";
            usertb.Text = TJDMStr;

            string str, strsy;
            string strresult = "";
            int num = ckboxlist.Items.Count;
            if (checkbase.Checked == true)
            {
                JHStr = ddlycname.SelectedItem.Text;
            }
            else
            {
                JHStr = yc_nametb.Text;
            }
            string delestr = "select count(*) from xmk_a_z_ny01 where CW='" + JHStr + "'";
            XMK_A_Z_NY01Biz bll = new XMK_A_Z_NY01Biz();

            if (bll.IsExist(delestr))
            {
                string deletestr = "delete from xmk_a_z_ny01 where CW='" + JHStr + "'";
                bll.Delete(deletestr);
            }
            if (JHStr == "请选择")
            {
                MessageLabel.Text = "请选择正确的YCZMC！";
                return;
            }
            else
            {
                MessageLabel.Text = "";
            }
            for (int i = 0; i < num; i++)
            {
                if (ckboxlist.Items[i].Selected)
                    strresult += "'" + ckboxlist.Items[i].Text + "'" + ",";
            }

            if (strresult.Length == 0)
            {

                MessageLabel.Text = "请选择统计类型！";
            }
            else
            {
                strresult = strresult.Substring(0, strresult.Length - 1);

                try
                {
                    if (checkbase.Checked == true)
                    {
                        str = " and (YCZMC ='" + JHStr + "') and  (JH in(" + tb.Text + ")) order by DJSD1 asc";
                        YQCJDBLL yqcjbll = new YQCJDBLL();
                        DataSet ds1 = yqcjbll.GetData(str); //得到数据集
                        int number = ds1.Tables[0].Rows.Count;//记录集的数目1891					
                        if (number == 0)
                            MessageLabel.Text = "没有符合条件的统计值！";
                        else
                        {
                            MessageLabel.Text = "";
                            double dlx = 0, dly = 0;
                            for (int i = 0; i < number; i++)//对应的是每一层
                            {
                                string hjyjh = ds1.Tables[0].Rows[i]["JH"].ToString();
                                //string strzb = "select X,Y	from GISWELL where JH='" + hjyjh + "'";
                                //DataSet dszb = serclient.GetDataSet(strzb);
                                //dlx = Convert.ToDouble(dszb.Tables[0].Rows[0][0].ToString());
                                //dly = Convert.ToDouble(dszb.Tables[0].Rows[0][1].ToString());
                                MAXfl = MINfl = AVEfl = LJZfl = 0;
                                JHStr = JHStr;
                                DingJSDfl = Convert.ToDouble(ds1.Tables[0].Rows[i]["DJSD1"].ToString());
                                DIJSDfl = Convert.ToDouble(ds1.Tables[0].Rows[i]["DJSD2"].ToString());
                                CWStr = ds1.Tables[0].Rows[i]["YCZMC"].ToString();
                                HDfl = DIJSDfl - DingJSDfl;
                                //strny="select * from  LJT_YXPM where (JH='"+JHStr+"')and (DJSD1 >='"+DingJSDfl+"')and  (DJSD2<='"+DIJSDfl+"') and (YXMC like '%泥岩%')";
                                strsy = " and where (JH='" + hjyjh + "')and (DBSD1 >='" + DingJSDfl + "')and  (DBSD<='" + DIJSDfl + "') and (YXMC in(" + strresult + "))";
                                LJT_YXPMBLL ljtbll = new LJT_YXPMBLL();
                                DataSet ds2 = ljtbll.GetData(strsy);
                                int number2 = ds2.Tables[0].Rows.Count;
                                if (number2 == 0)
                                    MessageLabel.Text = MessageLabel.Text;
                                else
                                {

                                    int j;
                                    LJZfl = 0;
                                    for (j = 0; j < number2; j++)//比较大小取出最大，最小，平均值
                                    {
                                        //string JHSTR1;

                                        double Dingj, DIj;
                                        // JHSTR1=ds2.item[j][0];
                                        Dingj = Convert.ToDouble(ds2.Tables[0].Rows[j]["DJSD1"].ToString());
                                        DIj = Convert.ToDouble(ds2.Tables[0].Rows[j]["DJSD2"].ToString());
                                        if (j == 0)
                                        {

                                            MAXfl = MINfl = AVEfl = LJZfl = DIj - Dingj;

                                        }
                                        else
                                        {
                                            if ((DIj - Dingj) >= MAXfl) MAXfl = Convert.ToDouble(DIj - Dingj);
                                            if ((DIj - Dingj) <= MINfl) MINfl = Convert.ToDouble(DIj - Dingj);
                                            LJZfl = LJZfl + (DIj - Dingj);
                                        }


                                    }
                                    AVEfl = LJZfl / j;
                                    SDBfl = LJZfl / HDfl;
                                    MAXfl = Math.Round(MAXfl, 2);
                                    MINfl = Math.Round(MINfl, 2);
                                    HDfl = Math.Round(HDfl, 2);
                                    AVEfl = Math.Round(AVEfl, 2);
                                    LJZfl = Math.Round(LJZfl, 2);
                                    SDBfl = Math.Round(SDBfl, 2);
                                    string stringjh = ds1.Tables[0].Rows[i]["JH"].ToString();
                                    XMK_A_Z_NY01Info model = new XMK_A_Z_NY01Info();
                                    model.JH = stringjh;
                                    model.DJDM = "1";
                                    model.CW = CWStr;
                                    model.DINGJSD = Convert.ToDecimal(DingJSDfl);
                                    model.DIJSD = Convert.ToDecimal(DIJSDfl);
                                    model.HD = Convert.ToDecimal(HDfl);
                                    model.MAX = Convert.ToDecimal(MAXfl);
                                    model.MIN = Convert.ToDecimal(MINfl);
                                    model.AVER = Convert.ToDecimal(AVEfl);
                                    model.LJHD = Convert.ToDecimal(LJZfl);
                                    bool bl = bll.Add(model);
                                    if (bl == false)
                                    {
                                        MessageLabel.Text = "没有成功统计！";
                                        return;
                                    }
                                    
                                }

                            }
                        }
                    }
                    else
                    {
                        string hjyjh = "";
                        double dlx = 0, dly = 0;
                        if (yc_nametb.Text.Trim() == "" || starttb.Text.Trim() == "" || endtb.Text.Trim() == "")
                        {
                            MessageLabel.Text = "请填写层名以及起始井深！";
                            return;
                        }
                        else
                        {
                            MessageLabel.Text = "";
                        }
                        //string strzb = "select JH,X,Y from GISWELL where JH in (" + tb.Text + ")";// and YC='"+yc_nametb.Text +"'";
                        //DataSet dszb = serclient.GetDataSet(strzb);
                        //for (int i = 0; i < dszb.Tables[0].Rows.Count; i++)
                        //{
                        //    hjyjh = dszb.Tables[0].Rows[i][0].ToString();
                        //    dlx = Convert.ToDouble(dszb.Tables[0].Rows[i][1].ToString());
                        //    dly = Convert.ToDouble(dszb.Tables[0].Rows[i][2].ToString());
                        //    MAXfl = MINfl = AVEfl = LJZfl = 0;
                        //    JHStr = JHStr;
                        //    DingJSDfl = Convert.ToDouble(starttb.Text);
                        //    DIJSDfl = Convert.ToDouble(endtb.Text);
                        //    CWStr = yc_nametb.Text;
                        //    HDfl = DIJSDfl - DingJSDfl;

                        //    strsy = "select JH,DBSD1,DBSD from  zhuluoji.ljt_YXPM where (JH='" + hjyjh + "')and (DBSD1 >=" + DingJSDfl + ")and  (DBSD<=" + DIJSDfl + ") and (YXMC in(" + strresult + "))";
                        //    DataSet ds2 = serclient.GetDataSet(strsy);
                        //    int number2 = ds2.Tables[0].Rows.Count;
                        //    if (number2 == 0)
                        //        MessageLabel.Text = MessageLabel.Text;
                        //    else
                        //    {
                        //        int j;
                        //        LJZfl = 0;
                        //        double maxds1 = 0, maxds2 = 0, minds1 = 0, minds2 = 0;
                        //        for (j = 0; j < number2; j++)//比较大小取出最大，最小，平均值
                        //        {
                        //            double Dingj, DIj;
                        //            Dingj = Convert.ToDouble(ds2.Tables[0].Rows[j][1].ToString());
                        //            DIj = Convert.ToDouble(ds2.Tables[0].Rows[j][2].ToString());
                        //            if (j == 0)
                        //            {
                        //                maxds1 = minds1 = Dingj;
                        //                maxds2 = minds2 = DIj;
                        //                MAXfl = MINfl = AVEfl = LJZfl = DIj - Dingj;
                        //            }
                        //            else
                        //            {
                        //                if ((DIj - Dingj) >= MAXfl)
                        //                {
                        //                    MAXfl = Convert.ToDouble(DIj - Dingj);
                        //                    maxds1 = Dingj;
                        //                    maxds2 = DIj;
                        //                }
                        //                if ((DIj - Dingj) <= MINfl)
                        //                {
                        //                    MINfl = Convert.ToDouble(DIj - Dingj);
                        //                    minds1 = Dingj;
                        //                    minds2 = DIj;
                        //                }
                        //                LJZfl = LJZfl + (DIj - Dingj);
                        //            }

                        //        }
                        //        AVEfl = LJZfl / j;
                        //        SDBfl = LJZfl / HDfl;
                        //        MAXfl = Math.Round(MAXfl, 2);
                        //        MINfl = Math.Round(MINfl, 2);
                        //        HDfl = Math.Round(HDfl, 2);
                        //        AVEfl = Math.Round(AVEfl, 2);
                        //        LJZfl = Math.Round(LJZfl, 2);
                        //        SDBfl = Math.Round(SDBfl, 2);
                        //        string stringjh = dszb.Tables[0].Rows[i][0].ToString();
                        //        bool bl = serclient.WriteToDBN(usertb.Text, stringjh, CWStr, dlx, dly, DingJSDfl, DIJSDfl, HDfl, MAXfl, MINfl, AVEfl, LJZfl, SDBfl);
                        //        if (bl == false)
                        //        {
                        //            MessageLabel.Text = "没有成功统计！";
                        //            return;
                        //        }
                        //    }
                        //}

                    }
                    btnDownLoad.Enabled = true;
                    string strds = " and where DJDM='" + usertb.Text + "' and JH in (" + tb.Text + ") and CW='" + JHStr + "' order by DINGJSD asc";

                    DataSet dataset = bll.GetData(strds);
                    if (dataset.Tables[0].Rows.Count == 0)
                        MessageLabel.Text = "没有统计数据！";
                    else
                    {
                        TJDataGrid.DataSource = dataset;
                        TJDataGrid.DataBind();
                        string sql = "";
                        if (checkbase.Checked == true)
                        {
                            sql = " and cw='" + ddlycname.SelectedItem.Text + "' order by dingjsd";
                        }
                        else
                        {
                            sql = " and cw='" + yc_nametb.Text + "' order by dingjsd";

                        }
                        BindPeople(sql);
                    }
                }
                catch (Exception ee)
                {
                    throw ee;
                }
            }
        }



        protected void checkbase_CheckedChanged(object sender, System.EventArgs e)
        {
            if (checkbase.Checked == true)
            {
                yc_namelabel.Enabled = false;
                yc_nametb.Enabled = false;
                SELabel.Enabled = false;
                starttb.Enabled = false;
                endtb.Enabled = false;
                ycname1.Enabled = true;
                ddlycname.Enabled = true;
            }
        }

        protected void checkperson_CheckedChanged(object sender, System.EventArgs e)
        {
            if (checkperson.Checked == true)
            {
                yc_namelabel.Enabled = true;
                yc_nametb.Enabled = true;
                SELabel.Enabled = true;
                starttb.Enabled = true;
                endtb.Enabled = true;
                ycname1.Enabled = false;
                ddlycname.Enabled = false;
                ButtonSYCW.Enabled = true;
                SYButton.Enabled = false;
            }
        }

        protected void commitJH_Click(object sender, System.EventArgs e)
        {
            ckboxlist.Items.Clear();
            SYButton.Enabled = true;
            string strjh = inputJH.Text;
            string strcw = "";
            strjh = strjh.Replace("，", ",");
            strjh = "'" + strjh.Replace(",", "','") + "'";
            tb.Text = strjh;
            strcw = GetHaveCW(strjh);
            FillListFromPara(strcw, ddlycname);
            SYButton.Visible = true;
            string strSql = " and (YXMC like '%泥岩%') and (JH in (" + tb.Text + "))";//(JH in ("+jhstring+"))
            LJT_YXPMBLL bll = new LJT_YXPMBLL();

            DataSet ds = bll.GetData(strSql); //serclient.GetDataSet(strSql);
            DataTable dt = ds.Tables[0];
            int num = dt.Rows.Count;
            for (int i = 0; i < num; i++)
            {
                ListItem li = new ListItem();
                li.Value = dt.Rows[i]["YXMC"].ToString();
                li.Text = dt.Rows[i]["YXMC"].ToString();
                ckboxlist.Items.Add(li);
            }
            //  ckboxlist.RepeatColumns =num;
            Checkall.Enabled = true;
            if (Checkall.Checked == true)
            {
                for (int i = 0; i < num; i++)
                {
                    ckboxlist.Items[i].Selected = true;
                }
            }
        }

        protected void ddlycname_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            ButtonSYCW.Enabled = true;
            SYButton.Enabled = false;
        }


        //绑定chart图表
        protected void BindPeople(string SQL)
        {

            XMK_A_Z_NY01Biz bll = new XMK_A_Z_NY01Biz();
            DataSet ds = bll.GetData(SQL);
            DataTable dt = ds.Tables[0];
            ChartPeople.DataSource = dt;
            ChartPeople.Series["DINGJSD"].XValueMember = "JH";
            ChartPeople.Series["DINGJSD"].YValueMembers = "DINGJSD";
            ChartPeople.Series["DIJSD"].YValueMembers = "DIJSD";
            ChartPeople.Series["HD"].YValueMembers = "HD";
            ChartPeople.Series["AVER"].YValueMembers = "AVER";
            ChartPeople.Series["LJHD"].YValueMembers = "LJHD";
            ChartPeople.Series["SDB"].YValueMembers = "SDB";
            ChartPeople.DataBind();//绑定数据";
        }

       
    }
}